package com.yohann.designPattern.interpreter;

import java.util.HashMap;

/**
 * <p>
 * 加法表达式
 * </p>
 *
 * @author Yohann
 * @since 2021/2/13 16:30
 */
public class AddExpression extends SymbolExpression {
    public AddExpression(Expression left, Expression right) {
        super(left, right);
    }

    @Override
    public int interpreter(HashMap<String, Integer> var) {
        return super.getLeft().interpreter(var) + super.getRight().interpreter(var);
    }
}